home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / person / bbs_time.zip / BBS_TIME.DOC < prev    next >
Text File  |  1991-06-16  |  8KB  |  208 lines

  1.  
  2.  
  3.  
  4.                                BBS Time Utilities
  5.  
  6.                   Three time utilities to facilitate operation
  7.                   of DOS based BBS's and other 24 hour per day
  8.                                    operations.
  9.  
  10.                                      IS_DST
  11.                                     ADJ_TIME
  12.                                     TIMECHEK
  13.  
  14.                          Copyright 1991, Steve Antonoff
  15.                                 3917 Garfield Dr.
  16.                             Stone Mountain, GA  30083
  17.  
  18.                                FIDOnet: 1:133/302
  19.                                 EGGnet: 99:9000/6
  20.  
  21.                                   June 16, 1991
  22.                       BBS Time Utilities by Steve Antonoff
  23.  
  24.  
  25.  
  26.         IS_DST - checks for Daylight Savings Time in the USA
  27.         ADJ_TIME  -  adjusts  DOS system clock by n  hours  (positive  or
  28.         negative)
  29.  
  30.         IS_DST  and ADJ_TIME were writted to accommodate the  semi-annual
  31.         insanity of changing the clock.
  32.  
  33.         IS_DST will check the current DATE and determine if the  Daylight
  34.         Savings Time is in effect, based on current (6/16/91) laws of the
  35.         USA  which define Daylight Savings Time as being in  effect  from
  36.         the  first  Sunday in April through the last Sunday  in  October.
  37.         IS_DST  does NOT check for the time of day (that is,  it  assumes
  38.         that the time change occurs at midnight, not at 2AM). As a result
  39.         of  this, it is best if it is NOT run between midnight  and  1:00
  40.         A.M.  More on this later!
  41.  
  42.         ADJ_TIME  will  adjust the system clock forward or  backward  the
  43.         specified  number  of  hours.   There are  two  common  uses  for
  44.         ADJ_TIME: (1) daylight savings time on/off and (2) changing  time
  45.         zones for portable computers.
  46.  
  47.         Usage:
  48.  
  49.         IS_DST will set the DOS errorlevel to 1 if Daylight Savings  Time
  50.         is in effect; it will set the errorlevel to 0 if Daylight Savings
  51.         Time  is  NOT  in  effect.   Here's  how  I  use  IS_DST  in   my
  52.         AUTOEXEC.BAT file:
  53.  
  54.         is_dst
  55.         if errorlevel 1 got DST
  56.         set TZ=EST5
  57.         del c:\EDT
  58.         echo x>c:\EST
  59.         goto TZCONTINUE
  60.         :DST
  61.         del C:\EST
  62.         echo x>c:\EDT
  63.         set TZ=EDT4
  64.         :TZCONTINUE
  65.  
  66.         The flag files (EDT and EST) are used to keep track of what  time
  67.         was  in  effect when the system last booted.   These  files  will
  68.         enable  the  BBS to automatically adjust its time when  the  time
  69.         changes.
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.                Copyright 1991, Steve Antonoff, Stone Mountain, GA
  83.                                      Page 1
  84.                       BBS Time Utilities by Steve Antonoff
  85.  
  86.  
  87.         My nightly cleanup starts at 2:15 AM, a perfect time to check for
  88.         the start or end of Daylight Savings Time.  So, in my CLEANUP.BAT
  89.         file,  which  is executed at 2:15 AM every night by  my  BINK.BAT
  90.         file, I have:
  91.  
  92.         ---------------------------------------------------------------
  93.         rem check to see if between midnight and 1 am - for safety sake
  94.         timechek -r 00:00 01:00
  95.         if errorlevel 1 goto TZEND
  96.         is_dst
  97.         if errorlevel 1 goto DST
  98.  
  99.         :EST
  100.         rem Eastern Standard Time is in effect
  101.         rem if C:\EST exists, don't do anything
  102.         if exist c:\est goto TZEND
  103.         rem Change from DAYLIGHT to STANDARD time!
  104.         rem Set TZ variable
  105.         set TZ=EST5
  106.         rem Adjust system clock
  107.         adj_time -1
  108.         rem delete EDT flag file
  109.         del c:\edt
  110.         rem create EST flag file
  111.         echo x>c:\est
  112.         goto TZEND
  113.  
  114.         :EDT
  115.         rem Eastern Daylight Time is in effect
  116.         rem if C:\EDT exists, don't do anything
  117.         if exist c:\edt goto TZEND
  118.         rem Change from STANDARD to DAYLIGHT time!
  119.         rem Set TZ variable
  120.         set TZ=EDT4
  121.         rem Adjust system clock
  122.         adj_time 1
  123.         rem delete EST flag file
  124.         del c:\est
  125.         rem create EDT flag file
  126.         echo x>c:\edt
  127.  
  128.         :TZEND
  129.         ---------------------------------------------------------------
  130.  
  131.         Ok,  why  the check for times between midnight and  1AM?   Here's
  132.         what  could happen (an unlikely scenario, but Murphy lives at  my
  133.         house!):
  134.  
  135.         Suppose the for some reason, (system crash or locked up, etc) the
  136.         cleanup  procedure  is run between midnight and 1AM,  and  it  is
  137.         going  to make the time adjustment from Daylight Savings Time  to
  138.         Standard Time.  Without the trap, the time would be adjusted back
  139.         an hour, to a time BEFORE MIDNIGHT.  Because of the way  ADJ_TIME
  140.         was  written, the date is adjusted correctly, making  it  between
  141.         11PM  and  midnight on the previous day.  Well, now  IS_DST  will
  142.  
  143.  
  144.                Copyright 1991, Steve Antonoff, Stone Mountain, GA
  145.                                      Page 2
  146.                       BBS Time Utilities by Steve Antonoff
  147.  
  148.  
  149.         report  that it IS daylight savings time, again, and the  process
  150.         could  loop for an hour, changing from Daylight to  Standard  and
  151.         back  again!   So, it is safest to use TIMECHK to  eliminate  the
  152.         possibility  of  moving  the time between midnight  and  1AM.   I
  153.         suppose I could have written IS_DST to check for the time on  the
  154.         acutal  switch-over  day,  but,  hell, this  is  a  hobby,  ain't
  155.         it?
  156.  
  157.         Pseudo Legalese:
  158.  
  159.         Both  IS_DST and ADJ_TIME are hereby released for  non-commercial
  160.         public  use and distribution.  Commercial users,  please  contact
  161.         the  author at one of the addresses below.  All rights  reserved.
  162.         The programs and this documentation are Copyright, 1991, by Steve
  163.         Antonoff.
  164.  
  165.         To contact the Author:
  166.  
  167.         As  of  the time of release of this software, the author  can  be
  168.         contacted by normal mail at:
  169.  
  170.              Steve Antonoff
  171.              3917 Garfield Dr.
  172.              Stone Mountain, GA  30083
  173.  
  174.         or  via FIDOnet at address 1:133/302 or EGGnet at 99:9000/6.   My
  175.         BBS phone number is (404) 296-9681.  All of the above is  subject
  176.         to change, of course.
  177.  
  178.         Warranty:
  179.  
  180.         These programs are guaranteed not to cause solar flares on  Gamma
  181.         Hydra 4 (or was it Gamma Hydra 2?)  Other than that, the programs
  182.         are  provided  as-is.  Bug reports and/or  modification  requests
  183.         will be considered on an "as time permits" basis by the author.
  184.  
  185.         Non-USA considerations:
  186.  
  187.         As  previously indicated, IS_DST will only perform  correctly  in
  188.         the  United  States of America, and even there only  as  long  as
  189.         Congress  doesn't mess with the laws regarding  Daylight  Savings
  190.         Time.   Should non-USA sysops wish to make use of IS_DST, I  will
  191.         consider adding other country's or region's rules if someone will
  192.         define them to me properly.
  193.  
  194.         Miscellaneous:
  195.  
  196.         TIMECHEK  has been included in BBS_TIME.ZIP just to form  a  com-
  197.         plete  set; the only changes were to bring the source code up  to
  198.         ANSI C standards and to make the copyright notice consistent with
  199.         ADJ_TIME and IS_DST.
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.                Copyright 1991, Steve Antonoff, Stone Mountain, GA
  207.                                      Page 3
  208.